import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:gzmall_app/common/color_common.dart';
import 'package:gzmall_app/model/product.dart';

class FavoritesGoodsItemWidget extends StatelessWidget {
  Product goods;
  double width;

  FavoritesGoodsItemWidget(this.goods, this.width);

  @override
  Widget build(BuildContext context) {
    return Container(
        color: Colors.white,
        width: width,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            CachedNetworkImage(
              height: width,
              imageUrl: goods.avatar,
              fit: BoxFit.fill,
            ),
            Expanded(
              child: Container(
                padding: const EdgeInsets.only(
                    top: 4.0, bottom: 4.0, left: 4.0, right: 4.0),
                child: Text(
                  goods.name ?? "",
                  maxLines: 1,
                  overflow: TextOverflow.ellipsis,
                  style: TextStyle(fontSize: 14.0, color: ColorCommon.black1),
                ),
              ),
            ),
            Container(
              padding: const EdgeInsets.only(
                  top: 4.0, bottom: 4.0, left: 4.0, right: 4.0),
              child: Row(
                  mainAxisAlignment: MainAxisAlignment.center,
                  children: <Widget>[
                    Text(
                      "¥" + (goods.lowSalePrice ?? "0.0"),
                      style: TextStyle(
                        fontSize: 14.0,
                        color: ColorCommon.grey8,
                      ),
                    ),
                  ]),
            ),
          ],
        ));
  }
}
